﻿using System;
using System.Threading;
using System.Threading.Tasks;

namespace LiSA_Server.Base.Extensions
{
    public class BackgroundTask
    {
        /// <summary>
        /// Starts a background task in a sparate thread
        /// </summary>
        /// <param name="backgroundAction">The action to insert into a new thread</param>
        public static void New(Action backgroundAction)
        {
            Task.Factory.StartNew(
                    backgroundAction, 
                    CancellationToken.None, 
                    TaskCreationOptions.None,
                    TaskScheduler.Default
                );
        }
    }
}
